﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.2.8    拆借借出付款信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_FIN_EXCLOANOUTPAY: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_FIN_EXCLOANOUTPAY()
		{}
		#region Model
		private long _id;
		private long _custid;
		private long _excloanoutid;
		private string _paytype;
		private string _accountname;
		private string _bankname;
		private string _accountno;
		private decimal _amt;
		private string _exchangeno;
		/// <summary>
		/// 记录ID
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 客户记录ID
		/// </summary>
		[DataMember]
		public long CUSTID
		{
			get{return _custid;}
			set{
				if ( _custid!= value)
				{
					 _custid = value;
					OnPropertyChanged("CUSTID");
				}
			}
		}
		/// <summary>
		/// 拆借借出记录ID
		/// </summary>
		[DataMember]
		public long EXCLOANOUTID
		{
			get{return _excloanoutid;}
			set{
				if ( _excloanoutid!= value)
				{
					 _excloanoutid = value;
					OnPropertyChanged("EXCLOANOUTID");
				}
			}
		}
		/// <summary>
		/// 类型支出，不可修改
		/// </summary>
		[DataMember]
		public string PAYTYPE
		{
			get{return _paytype;}
			set{
				if ( _paytype!= value)
				{
					 _paytype = value;
					OnPropertyChanged("PAYTYPE");
				}
			}
		}
		/// <summary>
		/// 户名
		/// </summary>
		[DataMember]
		public string ACCOUNTNAME
		{
			get{return _accountname;}
			set{
				if ( _accountname!= value)
				{
					 _accountname = value;
					OnPropertyChanged("ACCOUNTNAME");
				}
			}
		}
		/// <summary>
		/// 银行
		/// </summary>
		[DataMember]
		public string BANKNAME
		{
			get{return _bankname;}
			set{
				if ( _bankname!= value)
				{
					 _bankname = value;
					OnPropertyChanged("BANKNAME");
				}
			}
		}
		/// <summary>
		/// 账号
		/// </summary>
		[DataMember]
		public string ACCOUNTNO
		{
			get{return _accountno;}
			set{
				if ( _accountno!= value)
				{
					 _accountno = value;
					OnPropertyChanged("ACCOUNTNO");
				}
			}
		}
		/// <summary>
		/// 支出金额
		/// </summary>
		[DataMember]
		public decimal AMT
		{
			get{return _amt;}
			set{
				if ( _amt!= value)
				{
					 _amt = value;
					OnPropertyChanged("AMT");
				}
			}
		}
		/// <summary>
		/// 水单号
		/// </summary>
		[DataMember]
		public string EXCHANGENO
		{
			get{return _exchangeno;}
			set{
				if ( _exchangeno!= value)
				{
					 _exchangeno = value;
					OnPropertyChanged("EXCHANGENO");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

